#include <REG51.H>
#include <Display.h>
#include <Clock.h>
#include <Buzzer.h>
#include <Key.h>
#include <Mode.h>
#include <Stopwatch.h>
#include <Timing.h>

void main(void)
{
    Buzzer_init();
    Clock_init();
    Stopwatch_init();
    Display_init();

    while (1)
    {
        switch (System_Mode)
        {
        case Mode_menu:
            Mode_menu_crtl();
            break;

        case Mode_Timing:
            Timing_ctrl();
            break;

        case Mode_Stopwatch:
            Stopwatch_ctrl();
            break;

        case Mode_hour_report:
            Buzzer_ctrl();
            break;
        }

        while (System_Mode == Mode_Clock)
        {
            if (Key_Scan() == Key0_Down)
            {
                System_Mode = Mode_menu;
            }
        }
    }
}
